package spring.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.event.ApplicationEventMulticaster;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author huu
 * @create 2025-08-25-15:10
 */

@Component
public class AsyncEventPublisher {
    @Autowired
    private ApplicationEventMulticaster eventMulticaster;

    @Async
    public void publishEvent(ApplicationEvent event) {
        eventMulticaster.multicastEvent(event);
    }

}
